// 使用你扩展的 Number 接口

const myNumber: Number = 123456.789;

// 调用扩展的 toLocaleString 方法
const localizedString = myNumber.toLocaleString('en-US', {
    style: 'currency',
    currency: 'USD',
});

console.log(localizedString);  // 输出格式化后的货币字符串

// 调用扩展的 toLocaleString 方法，使用中文区域设置
const localizedStringCn = myNumber.toLocaleString('zh-CN', {
    style: 'currency',
    currency: 'CNY',
});
console.log(localizedStringCn);  // 输出格式化后的人民币字符串

// 引入全局声明
/// <reference lib="es2020" />

// 假设有两个异步函数
function asyncFunction1(): Promise<string> {
    return new Promise(resolve => setTimeout(() => resolve('Result from asyncFunction1'), 1000));
}

function asyncFunction2(): Promise<number> {
    return new Promise(resolve => setTimeout(() => resolve(42), 500));
}

// 使用 allSettled 扩展方法
const promises = [asyncFunction1(), asyncFunction2()];

Promise.allSettled(promises).then(results => {
    results.forEach(result => {
        if (result.status === 'fulfilled') {
            console.log(`Fulfilled: ${result.value}`);
        } else {
            console.log(`Rejected: ${result.reason}`);
        }
    });
});